TextArea
| Kind of class: | class |
|---|---|
| Inherits from: | TextInput < UIComponent < MovieClip |
| Classpath: | gfx.controls.TextArea |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
TextArea is an editable text field component that supports multi-line text and an optional ScrollBar. It is derived from the CLIK TextInput component and thus includes all of the functionality and properties of TextInput. TextArea also shares the same states as its parent component.
Inspectable Properties
The inspectable properties of the TextArea component are similar to TextInput with a couple of additions and the omission of the password property. The additions are related to the CLIK ScrollBar component:
Like its parent, TextInput, the TextArea component supports three states based on its focused and disabled properties.
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
The inspectable properties of the TextArea component are similar to TextInput with a couple of additions and the omission of the password property. The additions are related to the CLIK ScrollBar component:
- text: Sets the text of the textField.
- visible: Hides the component if set to false.
- disabled: Disables the component if set to true.
- editable: Makes the TextInput non-editable if set to false.
- maxChars: A number greater than zero limits the number of characters that can be entered in the textField.
- scrollBar: Instance name of the CLIK ScrollBar component to use, or a linkage ID to the ScrollBar symbol – an instance will be created by the TextArea in this case.
- scrollPolicy: When set to “auto” the scrollBar will only show if there is enough text to scroll. The ScrollBar will always display if set to “on”, and never display if set to “off”. This property only affects the component if a ScrollBar is assigned to it (see the scrollBar property).
- defaultText: Text to display when the textField is empty. This text is formatted by the defaultTextFormat object, which is by default set to light gray and italics.
- actAsButton: If true, then the TextArea will behave similar to a Button when not focused and support rollOver and rollOut states. Once focused via mouse press or tab, the TextArea reverts to its normal mode until focus is lost.
- enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
- soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
Like its parent, TextInput, the TextArea component supports three states based on its focused and disabled properties.
- default or enabled state.
- focused state, typically a represented by a highlighted border around the textField.
- disabled state.
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The component’s visible property has been set to true at runtime.
- hide: The component’s visible property has been set to false at runtime.
- focusIn: The component has received focus.
- focusOut: The component has lost focus.
- textChange: The text field contents have changed.
- scroll: The text area has been scrolled.
- rollOver: The mouse cursor has rolled over the component when not focused. Only fired when the actAsButton property is set.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- rollOut: The mouse cursor has rolled out of the component when not focused. Only fired when the actAsButton property is set.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
Component metadata:
| InspectableList | "actAsButton" "defaultText" "disabled" "editable" "enableInitCallback" "inspectableScrollBar" "maxChars" "scrollPolicy" "soundMap" "textID" "visible" |
|---|
Summary
Constructor
Instance properties
- soundMap
- Mapping between events and sound process
- position
- The vertical scroll position of the text.
- scrollPolicy
- Determines when the component displays a scrollBar.
- scrollBar
- The component to use as a scrollBar.
- disabled
- Disable this component.
Instance properties inherited from TextInput
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
- handleInput
- Handle input from the game, via controllers or keyboard.Instance methods inherited from TextInputInstance methods inherited from UIComponent
Constructor
TextArea
function TextArea (
)
The constructor is called when a TextArea or a sub-class of TextArea is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend TextArea, ensure that a super() call is made first in the constructor. Instance properties
disabled
disabled:Boolean
(read,write)
Disable this component. Focus (along with keyboard events) and mouse events will be suppressed if disabled.
position
position:Number
(read,write)
The vertical scroll position of the text.
scrollBar
scrollBar:Object
(read,write)
The component to use as a scrollBar. The ScrollBar can be defined using a component instance in the
_parent scope, or by passing a linkage name to a ScrollBar symbol in the library. Unlike other scrolling components, only ScrollBars (including ScrollIndicator) can be used to scroll the TextArea. scrollPolicy
scrollPolicy:String
(read,write)
Determines when the component displays a scrollBar. When the scrollPolicy is "auto" the scrollBar will only show if there is enough text to scroll. When it is "on", it will always display, and when it is "off", it will never display.
soundMap
soundMap:Object = { theme:"default", focusIn:"focusIn", focusOut:"focusOut", textChange:"textChange", scroll:"scroll" }
(read,write)
Mapping between events and sound process
Instance methods
handleInput
Handle input from the game, via controllers or keyboard. The default handleInput will handle standalone and composite components.
Parameters:
details :
An
InputDetails object containing details from the interaction.pathToFocus:
A list of children in the focus path that are below this component. Components are responsible for calling
handleInput() on the next component in the pathToFocus unless they choose to intercept the call.Overrides: